Applying Multi-Level Sorting in Microsoft Excel
Course: Advanced Excel
Topic: Applying Multi-Level Sorting
Course Link: Advanced Excel Course – JustAcademy
Demo Link: Register for a Course Demo
Official Website: JustAcademy
1. Introduction to Multi-Level Sorting
Multi-level sorting is an advanced Microsoft Excel feature that arranges data according to two or more sorting criteria. Instead of sorting a dataset using only one column, you can define a primary sorting column and additional secondary or tertiary columns to organize records more precisely.
For example, an employee dataset can first be sorted by department in alphabetical order, then by employee name from A to Z within each department, and finally by salary from highest to lowest when employees share the same name.
This technique is useful for organizing large datasets, analyzing sales performance, preparing employee reports, arranging student marks, and managing inventory records. Excel supports up to 64 sorting levels for a multi-column sort.
Learning Objectives
- Understand the concept of multi-level sorting.
- Differentiate between primary, secondary, and tertiary sorting criteria.
- Use the Sort dialog box to create multiple sorting levels.
- Sort text, numbers, dates, and custom lists.
- Change the priority of sorting levels.
- Identify and troubleshoot common sorting errors.
- Apply multi-level sorting to practical business datasets.
2. What Is Sorting in Excel?
Sorting is the process of arranging records in a particular order based on selected values. Excel allows users to organize information alphabetically, numerically, chronologically, or according to custom requirements.
Common Types of Sorting
| Sorting Type |
Description |
Example |
| Ascending Text |
Arranges text from A to Z. |
Amit, Neha, Rahul |
| Descending Text |
Arranges text from Z to A. |
Rahul, Neha, Amit |
| Ascending Numbers |
Arranges numbers from smallest to largest. |
100, 250, 500 |
| Descending Numbers |
Arranges numbers from largest to smallest. |
500, 250, 100 |
| Ascending Dates |
Arranges dates from oldest to newest. |
01-Jan, 15-Feb, 20-Mar |
| Descending Dates |
Arranges dates from newest to oldest. |
20-Mar, 15-Feb, 01-Jan |
| Custom List |
Uses a predefined order instead of a standard alphabetical order. |
High, Medium, Low |
3. Understanding Multi-Level Sorting
Multi-level sorting applies sorting rules in a specific priority order. Excel evaluates the first sorting level before using subsequent levels to organize records that have equal values in the preceding criteria.
Primary Sorting Level
The primary level is the first and most important sorting criterion. It organizes the main groups in the dataset.
Example: Sort employees by Department from A to Z.
Secondary Sorting Level
The secondary level sorts records within groups that have the same primary value.
Example: Within each department, sort employees by Name from A to Z.
Tertiary Sorting Level
The tertiary level provides another sorting rule when records match on the first two criteria.
Example: Within each department and employee-name group, sort Salary from largest to smallest.
Example of Sorting Priority
| Priority |
Column |
Order |
| Level 1 |
Department |
A to Z |
| Level 2 |
Employee Name |
A to Z |
| Level 3 |
Salary |
Largest to Smallest |
The first level establishes the department order. The second arranges employees within each department, and the third compares salaries among records that match the first two criteria.
4. Sample Dataset for Multi-Level Sorting
Consider the following employee dataset before sorting.
| Employee ID |
Department |
Employee Name |
Salary |
| 104 |
Sales |
Rahul |
45000 |
| 101 |
IT |
Neha |
65000 |
| 105 |
Sales |
Amit |
52000 |
| 102 |
IT |
Amit |
72000 |
| 106 |
HR |
Priya |
48000 |
| 103 |
IT |
Rahul |
60000 |
| 107 |
Sales |
Neha |
50000 |
| 108 |
HR |
Amit |
55000 |
Suppose the requirement is to sort the dataset by Department from A to Z, Employee Name from A to Z, and Salary from largest to smallest.
5. Step-by-Step Process for Applying Multi-Level Sorting
Step 1: Prepare the Dataset
- Ensure the dataset has clear column headings.
- Check that each row represents one complete record.
- Remove unnecessary blank rows or columns within the data range.
- Verify that dates and numerical values are stored in appropriate formats.
- Save a backup if the original record order needs to be preserved.
Step 2: Select the Dataset
Click any cell within the dataset. Excel can usually identify the surrounding data automatically. Alternatively, select the entire data range, including all related columns.
Important: Always sort the complete table rather than an isolated column. Sorting only one column can separate employee names from their departments, salaries, and IDs.
Step 3: Open the Sort Dialog Box
- Go to the Data tab.
- Locate the Sort & Filter group.
- Click Sort to open the Sort dialog box.
- Ensure that My data has headers is selected if your dataset contains column headings.
Step 4: Configure the Primary Sorting Level
- In the Sort by dropdown, select Department.
- Under Sort On, select Cell Values.
- Under Order, select A to Z.
This creates the primary sorting rule and arranges department names alphabetically.
Step 5: Add the Secondary Sorting Level
- Click Add Level.
- In the Then by dropdown, select Employee Name.
- Choose Cell Values under Sort On.
- Select A to Z under Order.
This sorts employee names alphabetically within each department.
Step 6: Add the Tertiary Sorting Level
- Click Add Level again.
- Select Salary under the Then by column.
- Choose Cell Values under Sort On.
- Select Largest to Smallest under Order.
This sorts salaries from highest to lowest among records that match the previous sorting criteria.
Step 7: Apply the Sorting Rules
- Review the sorting levels and their priority.
- Confirm that the header option is correct.
- Click OK.
- Review the sorted records to verify that all rows remain correctly associated.
6. Expected Result After Multi-Level Sorting
Using Department (A to Z), Employee Name (A to Z), and Salary (Largest to Smallest), the dataset will be arranged as follows.
| Employee ID |
Department |
Employee Name |
Salary |
| 108 |
HR |
Amit |
55000 |
| 106 |
HR |
Priya |
48000 |
| 102 |
IT |
Amit |
72000 |
| 101 |
IT |
Neha |
65000 |
| 103 |
IT |
Rahul |
60000 |
| 105 |
Sales |
Amit |
52000 |
| 107 |
Sales |
Neha |
50000 |
| 104 |
Sales |
Rahul |
45000 |
Observation: Departments appear alphabetically. Within each department, employee names appear alphabetically. The salary level becomes relevant only when records match on the department and employee name criteria.
7. Changing the Priority of Sorting Levels
The order of sorting levels affects the final result. A column listed higher in the Sort dialog box has a higher priority than a column listed below it.
How to Change Sorting Priority
- Open Data > Sort.
- Select the sorting level you want to move.
- Use the Up or Down arrows to change its position.
- Review the new priority order.
- Click OK to apply the revised sorting rules.
Example: If Salary is moved to the first level and set to Largest to Smallest, employees will be grouped by salary order first rather than department. Department and employee name will be used to organize records that tie on salary.
8. Copying and Deleting Sorting Levels
Excel provides options to manage sorting criteria within the Sort dialog box.
Copy Level
The Copy Level option duplicates a selected sorting rule. You can then change the column or order to create another criterion.
Delete Level
The Delete Level option removes a sorting rule that is no longer required. Excel retains at least one sorting level.
When to Use These Options
- Copy levels when creating similar sorting configurations.
- Delete levels when simplifying a sorting process.
- Review the remaining priority order after making changes.
9. Multi-Level Sorting by Dates and Numbers
Multi-level sorting is especially useful when reports combine dates, categories, and numerical measures.
Example: Sales Transactions
| Region |
Salesperson |
Sale Date |
Sales Amount |
| West |
Rahul |
12-Mar-2026 |
25000 |
| East |
Neha |
05-Mar-2026 |
40000 |
| West |
Amit |
10-Mar-2026 |
35000 |
| East |
Amit |
02-Mar-2026 |
30000 |
| West |
Neha |
08-Mar-2026 |
45000 |
Possible Sorting Configuration
| Level |
Column |
Order |
| 1 |
Region |
A to Z |
| 2 |
Sale Date |
Oldest to Newest |
| 3 |
Sales Amount |
Largest to Smallest |
This configuration groups transactions by region, arranges dates within each region chronologically, and uses sales amount to break ties when the preceding criteria are identical.
10. Sorting with Custom Lists
Sometimes alphabetical order is not appropriate. For example, business reports may need priority levels arranged as High, Medium, and Low, or months arranged from January through December.
A custom list allows Excel to use a predefined sequence instead of its standard alphabetical or numerical order.
Example: Sorting by Priority
| Task |
Priority |
| Prepare report |
Medium |
| Fix critical issue |
High |
| Update documentation |
Low |
| Resolve customer complaint |
High |
Steps to Apply a Custom List
- Open Data > Sort.
- Select the Priority column.
- Under Order, select Custom List.
- Choose or create the sequence High, Medium, Low.
- Click OK to confirm the custom order.
You can combine a custom-list sort with additional levels. For example, sort by Priority using High, Medium, Low, then by Due Date from oldest to newest.
11. Sorting by Cell Color, Font Color, or Icons
Excel can also sort data according to formatting when cells contain manually applied or conditionally formatted colors or icons.
Example
- Red fill: High-priority tasks.
- Yellow fill: Medium-priority tasks.
- Green fill: Low-priority tasks.
To configure this type of sorting, open Data > Sort, choose the relevant column, select Cell Color, Font Color, or Cell Icon under Sort On, and specify the desired order.
You can add more levels to combine formatting-based sorting with other criteria. For example, place red tasks first and then sort their due dates from oldest to newest.
12. Sorting Text, Numbers, and Dates Correctly
Multi-level sorting depends on Excel interpreting each value correctly. Inconsistent data types can produce unexpected results.
Text Sorting Issues
Leading spaces, inconsistent spelling, and mixed text formats can affect alphabetical ordering. Clean the values before sorting when necessary.
Number Sorting Issues
If some numbers are stored as text while others are stored as numeric values, Excel may not sort them as expected. Convert the values to a consistent type when appropriate.
Date Sorting Issues
Dates stored as text may sort alphabetically rather than chronologically. Convert text dates into valid Excel dates and verify regional date conventions before sorting.
Recommended Checks
- Confirm that all values in a sorting column use the intended data type.
- Remove unnecessary leading spaces.
- Standardize dates and numerical values.
- Verify the correct header-row setting.
- Inspect the results after applying the sort.
13. Common Multi-Level Sorting Mistakes
| Mistake |
Why It Happens |
Solution |
| Only one column gets sorted |
The user selects only one column rather than the full dataset. |
Select the complete table or use Excel's detected data range. |
| Header row moves into the data |
The header option is incorrectly configured. |
Enable My data has headers when appropriate. |
| Records appear in the wrong priority |
Sorting levels are listed in the wrong order. |
Move the primary criterion to the top of the list. |
| Numbers sort unexpectedly |
Some numeric values are stored as text. |
Convert the values to a consistent numeric type. |
| Dates are not chronological |
Some date values are stored as text. |
Convert the dates and verify their interpretation. |
| Related information becomes mismatched |
Only part of the dataset was sorted. |
Sort complete records together. |
| Results do not follow the expected sequence |
A custom order is required. |
Define and apply a custom list. |
14. Best Practices for Multi-Level Sorting
- Use clear, unique column headings.
- Convert the dataset into an Excel Table when useful, so the data range and headers are easier to manage.
- Define the primary sorting criterion before adding secondary levels.
- Keep all fields of each record together when sorting.
- Clean inconsistent text, dates, and numbers before applying the sort.
- Use custom lists for business-defined sequences.
- Review each sorting level before clicking OK.
- Keep a backup when the original record order is important.
- Use filters alongside sorting when you need to focus on specific records.
- Verify the sorted result before sharing or publishing a report.
15. Practical Exercise: Sort a Student Marks Dataset
Objective: Apply multi-level sorting to arrange students by class, total marks, and student name.
Sample Dataset
| Student ID |
Class |
Student Name |
Total Marks |
| 201 |
10 |
Rahul |
425 |
| 202 |
9 |
Neha |
450 |
| 203 |
10 |
Amit |
470 |
| 204 |
9 |
Amit |
430 |
| 205 |
10 |
Neha |
470 |
| 206 |
9 |
Rahul |
450 |
Tasks
- Sort Class from smallest to largest.
- Add Total Marks as the second sorting level, from largest to smallest.
- Add Student Name as the third sorting level, from A to Z.
- Apply the sorting rules to the complete dataset.
- Check that all student IDs remain associated with the correct names and marks.
Expected Sorting Logic
Class 9 students should appear before Class 10 students. Within each class, students with higher total marks should appear first. If two students have the same marks within a class, their names should be arranged alphabetically.
16. Interview Questions and Answers
Q1. What is multi-level sorting in Excel?
Answer: Multi-level sorting arranges a dataset using two or more criteria, such as department, employee name, and salary.
Q2. What is a primary sorting level?
Answer: It is the first sorting criterion and has the highest priority in determining the order of records.
Q3. How do you add a second sorting criterion?
Answer: Open Data > Sort, click Add Level, select the second column, and specify its sorting order.
Q4. How many sorting levels can Excel support?
Answer: Excel supports up to 64 sorting columns or levels in a multi-level sort.
Q5. Can Excel sort by both text and numbers?
Answer: Yes. For example, a dataset can be sorted by Department alphabetically and then by Salary from largest to smallest.
Q6. What is the purpose of a custom sort list?
Answer: A custom list allows values to be sorted in a user-defined sequence, such as High, Medium, and Low.
Q7. Why should the complete dataset be sorted?
Answer: Sorting the complete dataset ensures that related fields in each record remain associated. Sorting only one column can mismatch information.
Q8. What happens when two records have identical values at the first sorting level?
Answer: Excel uses the next sorting level to determine their relative order. Additional levels are evaluated when preceding criteria are equal.
Q9. Can Excel sort data by cell color?
Answer: Yes. The Sort dialog box supports sorting by cell color, font color, and conditional-formatting icons where available.
Q10. How can you correct an incorrect sorting order?
Answer: Reopen the Sort dialog box, verify the selected columns, orders, and priority levels, and apply the corrected configuration.
17. Quick Revision Checklist
- Understand primary, secondary, and tertiary sorting.
- Open the Sort dialog box from the Data tab.
- Use Add Level to introduce additional criteria.
- Use the Up and Down arrows to adjust priority.
- Apply ascending or descending orders according to the data type.
- Use custom lists when alphabetical order is unsuitable.
- Check that headers are identified correctly.
- Sort complete records rather than isolated columns.
- Check for text-formatted numbers and dates.
- Validate the final sorted dataset.
18. Conclusion
Multi-level sorting is an essential Advanced Excel skill for organizing complex datasets using multiple criteria. It allows users to group related records, sort information within groups, and prepare structured reports for business analysis.
By mastering the Sort dialog box, adding sorting levels, changing priority, and applying custom lists, you can organize employee data, sales transactions, student marks, and inventory records more efficiently. Always check data types and sort the entire dataset to preserve record accuracy.
Continue learning: Explore the Advanced Excel Course at JustAcademy to build practical spreadsheet and data-analysis skills.
Register for a course demo: https://www.justacademy.co/register-for-course-demo
Visit the official website: https://www.justacademy.co/